<template>
	<view class="dialog">
		<div class="bg" @click="close"></div>
		<div class="popBox">
			<span class="vip"></span>
			<div class="top">
				<i>兑换成功</i>
			</div>
			<div class="cont">
				<span class="score flexC">
					<i>- {{ score }}</i>积分
				</span>
				<span class="title show">兑换商品 - {{ title }}</span>
				<span class="btnBack flexC" @click="toUrl('/member')">返回个人中心</span>
			</div>
		</div>
	</view>
</template>

<script setup lang="ts">
	import { useRouter,useRoute } from 'vue-router';
	const router = useRouter();
	import { toUrl } from '../../utils/base.ts';
	const emit = defineEmits(['close']);
	defineProps({
		title:{
			type:String
		},
		score:{
			type:Number,
		}
	})
	function close(){
		emit('close',true);
	}
	function toUrl(url:string){
		router.push({
			path : url
		})
	}
</script>

<style lang="scss" scoped>
	.dialog{
		width: 100%;
		height: 100%;
		background: rgba(0,0,0,.5);
		position: fixed;
		left: 0;
		top:0;
		z-index:999;
		font-family: 'siyuanR';
		.bg{
			position: absolute;
			left: 0;
			width: 100%;
			height: 100%;
			top:0;
		}
	}
	.popBox{
		width: 340px;
		height: 270px;
		position: absolute;
		left: 50%;
		top:50%;
		transform: translate(-50%,-50%);
		border-radius:10px;
		z-index:10;
		&::before{
			background: linear-gradient(to bottom, #53adfc, #a8d3fc); 
			position: absolute;
			top:0;
			left: 0;
			width: 100%;
			height: 80px;
			content: '';
			border-radius:10px 10px 0 0;
		}
		.vip{
			position: absolute;
			background:url(../../assets/shop/vip.png) no-repeat;
			background-size:100%;
			width: 103px;
			height: 125px;
			right:45px;
			top:-25px;
			z-index:20;
		}
		.top{
			width: 100%;
			height: 65px;
			border-radius:10px 10px 0 0;
			position: relative;
			z-index:10;
			i{
				font-size: 18px;
				background:url(../../assets/shop/fare.png) no-repeat left center;
				background-size:32px 32px;
				padding-left: 40px;
				height: 100%;
				line-height: 65px;
				display: block;
				font-style: normal;
				color: #fff;
				font-family: 'siyuanM';
				margin-left: 55px;
			}
		}
		.cont{
			width: 100%;
			height: calc(100% - 65px);
			border-radius:10px;
			background: linear-gradient(to bottom, #d6e9fd, #fff,#fff); 
			position: relative;
			z-index: 10;
			padding-top: 40px;
			.score{
				color: #3366ff;
				line-height: 40px;
				i{
					font-style: normal;
					font-family: 'DIN';
					font-size: 26px;
					font-weight: bold;
				}
			}
			.title{
				padding: 0 10px;
				white-space: nowrap;
				overflow: hidden; 
				text-overflow: ellipsis; 
				width: 100%;
				color: #333333;
				font-size: 16px;
				text-align: center;
				line-height: 32px;
			}
			.btnBack{
				color: #fff;
				width: 120px;
				height: 35px;
				background: #2379f7;
				font-size: 15px;
				margin:25px auto;
				border-radius: 20px;
				cursor: pointer;
			}
		}
	}
</style>